fix(fresh): accept class + standard <form> attrs on managed Form formProps (#213)#228
Conversation
🤖 Augment PR SummarySummary: This PR expands the managed Changes:
Technical Notes: Keeps progressive enhancement ownership of 🤖 Was this summary useful? React with 👍 or 👎 |
| /** Caller overrides accepted by the managed form component's `formProps` bag. */ | ||
| export interface FormElementOverrideProps { | ||
| /** Additional standard, ARIA, data, or framework attributes for the form element. */ | ||
| readonly [attribute: string]: unknown; |
There was a problem hiding this comment.
packages/fresh/src/application/form/_internal/prop-types.ts:28 — The open index signature on FormElementOverrideProps means callers can pass framework-only props like dangerouslySetInnerHTML/children, which can prevent the managed hidden inputs (submission id + CSRF) from rendering. Consider explicitly preventing those props in formProps similar to how handler/ref keys are blocked/stripped.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
…eature sweep (#233) Storefront tutorial D-01…D-05 conformance to the shipped #206–#231 surface, plus accuracy reconciliation on the fresh-ui/web-layer pages the sweep touched. D-01 (01-scaffold): Aspire dashboard URL is https; fileTree includes database/ and tests/. D-02 (02-catalog-service): real #208 CRUD surface — createCrudContract + @database/zod + context.db; errors thrown via the contract's typed errors.NOT_FOUND (no hand-rolled notFound import); router nests health under products (no invented health-router import). D-03 (03-cart-contracts): register in mod.ts, PascalCase CartContractV1, import from @my-shop/contracts and the ./versions/v1 subpath. Reconciled 02's products.contract.ts exports to the same PascalCase convention (ProductsContract/ProductsContractV1) so ch2↔ch3 imports agree. D-04 (04/05): public `netscript plugin install saga|trigger --name … --samples`. Feature recon to the sweep: DataTable→DataGrid (#209/#225), Icon primitive (#211/#224) and DataGrid in fresh-ui root exports, Dropzone/prompt-input mentions (#214/#229, #212/#226), managed <Form> class + <form> attrs (#213/#228), useIslandMutation onMutate/onSettled (#210/#227). Docs-only. build + check:links + check:caveats green. Refs #153. Claude-Session: https://claude.ai/code/session_012wKHquACkXnWPDgJYhhFjN Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Summary
Widen the managed
@netscript/fresh/form<Form>formPropssurface so callers can passclass, standard form attributes, ARIA/data attributes, and framework attributes through the form prop bag.The render path now strips enhancement-owned handler/ref keys from
formPropsbefore spreading, preserving managed submit/enhancement ownership while keeping existing top-level prop behavior.Scope
@netscript/freshform public surface, Archetype 4 + frontend overlayformPropsattrsSlices
Validation
deno check --unstable-kv packages/fresh/src/application/form/mod.ts packages/fresh/src/application/form/components/form.test.tsx— PASSdeno test --allow-all packages/fresh/src/application/form/components/form.test.tsx— PASS, 4 passed / 0 faileddeno fmt --check packages/fresh/src/application/form/_internal/prop-types.ts packages/fresh/src/application/form/components/form.tsx packages/fresh/src/application/form/components/form.test.tsx packages/fresh/src/application/form/_internal/types.ts packages/fresh/src/application/form/runtime/types.ts packages/fresh/src/application/form/mod.ts— PASSrtk proxy deno task --cwd packages/fresh check— PASSrtk proxy deno task --cwd packages/fresh lint— PASSrtk proxy deno task --cwd packages/fresh fmt:check— PASSrtk proxy deno task --cwd packages/fresh publish:dry-run— PASSrtk proxy deno task check— PASSrtk proxy deno task lint— PASSrtk proxy deno task fmt:check— PASSrtk proxy deno task --cwd packages/fresh doc-lint— FAIL, existing unrelatedInferRoutePattern*/NetScriptVitePluginprivate-type refs plus npm type-resolution warnings; the changed form types no longer produce doc-lint errors.Harness
.llm/tmp/run/fix-managed-form-formprops-attrs--213/Drift / Debt
deno doc --lintprivate-type refs, so the implementation uses self-contained form prop interfaces with explicit managed fields and an open attribute index.Closes #213